package think.in.spring.bean.builder;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import think.in.spring.bean.factory.UserFactory;
import think.in.spring.bean.factory.impl.DefaultUserFactory;
import think.in.spring.bean.factory.impl.UserFactoryImpl;

import javax.annotation.PostConstruct;

public class BeanInitializeDemo {

    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(BeanInitializeDemo.class);
        UserFactory bean = context.getBean(UserFactory.class);
        System.out.println(bean.toString());
    }

    @Bean(initMethod = "initMethod")
    public UserFactory userFactory() {
        return new UserFactoryImpl();
    }
}
